package com.partner.service.login;

import org.springframework.stereotype.*;
import org.springframework.beans.factory.annotation.*;
import com.partner.frame.*;
import com.partner.bean.login.*;
import com.partner.mapper.login.*;

@Service("userinfoService")
public class UserinfoService extends BaseService<Userinfo> {

	@Autowired
	private UserinfoMapper serviceMapper;

	public UserinfoMapper getServiceMapper() {
		return serviceMapper;
	}

	/**
	 * 判断用户是否注册
	 * @param mapParam
	 * @return
	 */
	public Userinfo checkUserIsRegister(String phone) {
		return serviceMapper.checkUserIsRegister(phone);
	}
	
	
	/**
	 * 用户注册
	 * @param Userinfo
	 * @return
	 */
	public void addUser(Userinfo u){
			serviceMapper.addUser(u);
		
	}
	
	
	/**
	 * 根据电话更新userinfo信息
	 * @param phone
	 */
	public void upDate(Userinfo u){
		serviceMapper.update(u);
	}
	
	
	/**
	 * 查询用户所有
	 * 通过电话查询
	 * @param phone
	 */
	public Userinfo userAll(String phone){
		return serviceMapper.userAll(phone);
	}


	/**
	 * 判断账号密码是否一致
	 * @param phone
	 * @param pwdmd5
	 * @return
	 */
	public boolean loginUser(String phone, String pwdmd5) {
		boolean isre = false ; 
		
		Userinfo usr = serviceMapper.loginUser(phone,pwdmd5);
		if(usr!=null){
			isre = true ;
		}
		
		return isre;
	}





}
